package com.example.demozmq.zmq;

import java.nio.charset.StandardCharsets;
import org.zeromq.ZMQ;

public class ZmqPush {

    public static void main(String[] args) throws InterruptedException {

        ZMQ.Context context = ZMQ.context(1);
        ZMQ.Socket socket = context.socket(ZMQ.PUSH);

        socket.connect("ipc://fjs");

        for (int i = 1; i <= 10000; i++) {
            socket.send(("hello【" + i + "】").getBytes(StandardCharsets.UTF_8));
            System.out.println("已发送" + i + "次");
            Thread.sleep(3000);
        }
        socket.close();
        context.term();
    }

}
